import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EnterpriseVO, EnterpriseForm, EnterpriseQuery } from '@/api/system/enterprise/types';

/**
 * 查询企业基础信息列表
 * @param query
 * @returns {*}
 */

export const listEnterprise = (query?: EnterpriseQuery): AxiosPromise<EnterpriseVO[]> => {
  return request({
    url: '/system/enterprise/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询企业基础信息详细
 * @param id
 */
export const getEnterprise = (id: string | number): AxiosPromise<EnterpriseVO> => {
  return request({
    url: '/system/enterprise/' + id,
    method: 'get'
  });
};

/**
 * 新增企业基础信息
 * @param data
 */
export const addEnterprise = (data: EnterpriseForm) => {
  return request({
    url: '/system/enterprise',
    method: 'post',
    data: data
  });
};

/**
 * 修改企业基础信息
 * @param data
 */
export const updateEnterprise = (data: EnterpriseForm) => {
  return request({
    url: '/system/enterprise',
    method: 'put',
    data: data
  });
};

/**
 * 删除企业基础信息
 * @param id
 */
export const delEnterprise = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/enterprise/' + id,
    method: 'delete'
  });
};
